
const EnvContext = require('../../../common/context/EnvContext');
const { setHeighByRow } = require('../../../common/utils/mainWinUtil');
const { doSearchByKeyword } = require('./doSearchPluginByKeyword');
const { doSearchByFolder } = require('./doSearchPluginByFolder');
const { doSearchByFile } = require('./doSearchPluginByFile');
const { doOrderAndFilterPLugin } = require('./doOrderPlugin');


exports.searchPlugin = async function (event, request) {
    const data = await doSearch(request)
    const row = data.resultList.length + 1
    setHeighByRow(EnvContext.getInstance().mainWin, row)
    event.returnValue = data
}

async function doSearch(request) {
    const type = request.type
    if (type == "string") {
        return doSearchByKeyword(request)
    } else if (type == "folder") {
        return doSearchByFolder(request)
    } else if (type == "file") {
        return doSearchByFile(request)
    }
}


